# Maintainer: Balló György <ballogyor+arch at gmail dot com>
# Contributor: Steven Honeyman <stevenhoneyman at gmail com>
# Contributor: nbvcxz (b4283)

pkgname=l3afpad
pkgver=0.8.18.1.11
pkgrel=7
pkgdesc='Simple plain text editor for GTK 3'
arch=('loong64' 'x86_64')
url='https://github.com/stevenhoneyman/l3afpad'
license=('GPL2')
depends=('gtk3')
makedepends=('intltool')
source=("https://github.com/stevenhoneyman/l3afpad/archive/v$pkgver/$pkgname-$pkgver.tar.gz"
        'l3afpad.appdata.xml')
sha256sums=('86f374b2f950b7c60dda50aa80a5034b8e3c80ded5cd3284c2d5921b31652793'
            '742e3d2d23e6bad8f56dccafdccc6c1b36cebdb7dd178b1f19942fcb37fe3ff8')

prepare() {
  cd $pkgname-$pkgver
  sed -i 's|gtk_window_set_icon_from_file(GTK_WINDOW(mw->window), ICONDIR"/l3afpad.png", NULL);|gtk_window_set_icon_name(GTK_WINDOW(mw->window), "l3afpad");|' src/window.c
  ./autogen.sh
}

build() {
  cd $pkgname-$pkgver
  ./configure --prefix=/usr
  make
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install
  install -Dm644 ../$pkgname.appdata.xml "$pkgdir/usr/share/metainfo/$pkgname.appdata.xml"
  rm -r "$pkgdir/usr/share/pixmaps/"
}
